<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width:100px;
            height: 100px;
            border:1px solid red;
        }
    </style>
    <script>
        function doOver(obj){
            // console.log(obj);//DOM对象
            obj.style.color="red";
            console.log("鼠标悬浮事件");
        }
        function doOut(){
            var div=document.querySelector("div");//可以手动获取div的DOM对象
            div.style.color="green";
            console.log("鼠标离开事件");
        }
    </script>
</head>
<body>
    <!-- 
        mouseover鼠标移动到某个元素之上，即鼠标悬浮事件 
        mouseout鼠标离开事件
    -->

    <!-- this表示触发事件的元素，也称之为事件源 -->
    <div  onmouseover="doOver(this)" onmouseout="doOut()">div</div>
</body>
</html>